<%namespace name="admin_include" file="/admin/base/include.html" />
<%inherit file="/front/base/businessbase.html"/>
<%def name="script()">
${admin_include.validationEngine()}
${admin_include.ueditor()}
</%def>
<%def name="center()">
<div class="row">
    <h3 class="lit page-header no-margin" style="margin-bottom:10px;">商家信息</h3>
    %if info:
    <div class="alert alert-success"><strong>${info}</strong></div>
    %endif
    <form class="form-horizontal" id="dataform" action="/ajaxValidateSubmit" method="post" enctype="multipart/form-data">
        <fieldset>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td colspan="2">
                        <div class="control-group">
                        <label class="control-label control-label-small">名称</label>
                            <div class="controls controls-small">
                                <input name="companyname" type="text" value="${businessuser.companyname}" class="input-large" readonly/>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="control-group">
                        <label class="control-label control-label-small">管理人</label>
                            <div class="controls controls-small">
                                <input name="contactname" type="text" value="${businessuser.contactname or ''}" class="input-medium"/>
                            </div>
                        </div>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="control-group">
                        <label class="control-label control-label-small">商业类型</label>
                            <div class="controls controls-small">
                                <select name="businesstype" class="input-small">
                                <option value="-1">--请选择--</option>
                                %if businessuser:
                                ${h.getoptions('businesstype', str(businessuser.businesstype))|n}
                                %else:
                                ${h.getoptions('businesstype')|n}
                                %endif
                                </select>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="control-group">
                        <label class="control-label control-label-small">特色</label>
                            <div class="controls controls-small">
                                <input name="special" type="text" value="${businessuser.special or ''}" class="input-medium"/>
                            </div>
                        </div> 
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="control-group">
                        <label class="control-label control-label-small">邮箱</label>
                            <div class="controls controls-small">
                                <input name="email" type="text" value="${businessuser.email or ''}" class="input-medium validate[custom[email]]"/>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="control-group">
                        <label class="control-label control-label-small">手机</label>
                            <div class="controls controls-small">
                                <input name="contacttel" type="text" value="${businessuser.contacttel or ''}" class="input-medium validate[custom[integer]]"/>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="control-group">
                        <label class="control-label control-label-small">QQ</label>
                            <div class="controls controls-small">
                                <input name="qq" type="text" value="${businessuser.qq or ''}" class="input-medium validate[custom[integer]]"/>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="control-group">
                        <label class="control-label control-label-small">其它</label>
                            <div class="controls controls-small">
                                <input name="othercontacttool" type="text" value="${businessuser.othercontacttool or ''}" class="input-medium"/>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="control-group">
                        <label class="control-label control-label-small">地址</label>
                            <div class="controls controls-small">
                                <textarea class="input-xlarge" row="3" name="address">${businessuser.address or ''}</textarea>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="control-group">
                        <label class="control-label control-label-small">介绍</label>
                            <div class="controls controls-small">
                                    <textarea id="introduce" name="introduce">${businessuser and businessuser.introduce or ''}</textarea>
                                    <script type="text/javascript">
                                        var editor_a = new baidu.editor.ui.Editor({
                                                initialContent:'',
                                                minFrameHeight:150,
                                                });
                                        editor_a.render('introduce');
                                    </script>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="control-group">
                        <label class="control-label control-label-small">商家标识</label>
                            <div class="controls controls-small">
                                <input id="picture" name="picture" type="file"/>
                                %if businessuser and businessuser.picture:
                                <span class="help-block"><img src="${businessuser.picture}" class="img-polaroid"/></span>
                                %endif
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="form-actions">
                            <input type="hidden" name="id" value="${businessuser.id}"/>
                            <button class="btn btn-primary" type="submit">保存</button>
                            <button class="btn" type="reset">取消</button>
                        </div>
                    </td>
                </tr>

            </table>
        </fieldset>
    </form>
</div>
<script type="text/javascript">
function ajaxValidationCallback(status, form, json, options)
{
    if(status)
    {
        form.attr('action', '${request.url}');
        form.validationEngine('detach');
        form.submit();
    }
}
$(document).ready(function(){
    $('#dataform').validationEngine({
            ajaxFormValidation: true,
            onAjaxFormComplete: ajaxValidationCallback,
    })
});
</script>
</%def>
